package com.dlry.entity;
// Generated 2016-10-31 13:57:37 by Hibernate Tools 3.6.0.Final

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

/**
 * DlMeetingRoom generated by hbm2java
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "entityCache")
@Cacheable(true)
@Entity
@Table(name = "dl_meeting_room")
public class DlMeetingRoom implements java.io.Serializable {

	/**
	 * 
	 */
	@Transient
	private static final long serialVersionUID = 5931544655270917465L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	@Column(name = "room_name")
	@Length(min = 1, max = 20, message = "名称必须在1到20个汉字范围")
	private String roomName;
	@Column(name = "room_number")
	// @Size(min=1, max=4,message="请输入正确的房间号")
	@Range(min = 1, max = 1000, message = "请输入正确的房间号")
	private int roomNumber;
	@Column(name = "equipment")
	private String equipment;
	@ManyToOne
	@JoinColumn(name = "user_id")
	private DlLoginuser user;
	@OneToMany(targetEntity = DlMeetingRoomBooking.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "room")
	private Set<DlMeetingRoomBooking> bookings = new HashSet<DlMeetingRoomBooking>();

	public DlMeetingRoom() {
	}

	public DlMeetingRoom(String roomName, int roomNumber) {
		this.roomName = roomName;
		this.roomNumber = roomNumber;
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getRoomName() {
		return this.roomName;
	}

	public void setRoomName(String roomName) {
		this.roomName = roomName;
	}

	public int getRoomNumber() {
		return this.roomNumber;
	}

	public void setRoomNumber(int roomNumber) {
		this.roomNumber = roomNumber;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public void setUser(DlLoginuser user) {
		this.user = user;
	}

	public DlLoginuser getUser() {
		return user;
	}

	public Set<DlMeetingRoomBooking> getBookings() {
		return bookings;
	}

	public void setBookings(Set<DlMeetingRoomBooking> bookings) {
		this.bookings = bookings;
	}

	public void setEquipment(String equipment) {
		this.equipment = equipment;
	}

	public String getEquipment() {
		return equipment;
	}
}
